#!/usr/bin/env python
# encoding: utf-8
"""
@summary: 验证口碑数据，mapper
@author: hongxingfan
@since: 2014年11月13日    下午4:35:18
"""
import sys
import re

# 分为全部，首页，车型，详情，其他
if __name__ == '__main__':
    
    p_shouye = re.compile("^db.auto.sohu.com/chezhudianping/{0,1}$")
    p_model = re.compile("^db.auto.sohu.com/(model_|trim-)\w+/chezhudianping.*?$")
    p_detail = re.compile("^db.auto.sohu.com/chezhudianping/content.*?$")
    p_other = re.compile("^db.auto.sohu.com/koubei_collect/koubei_collect.*?$")
    
    for line in sys.stdin:
        line = line.strip()
        
        cols = line.split("\t")
        suv = cols[3]
        domain = cols[4]
        url = cols[5]
        
        str = domain + url
        pv = 1
        
        if re.search(p_shouye, str):
            print("%s\t%d\t%s" %("shouye",pv,suv))
            print("%s\t%d\t%s" %("all",pv,suv))
            continue
        elif re.search(p_model, str):
            print("%s\t%d\t%s" %("model",pv,suv))
            print("%s\t%d\t%s" %("all",pv,suv))
            continue
        elif re.search(p_detail, str):
            print("%s\t%d\t%s" %("detail",pv,suv))
            print("%s\t%d\t%s" %("all",pv,suv))
            continue
        elif re.search(p_other, str):
            print("%s\t%d\t%s" %("other",pv,suv))
            print("%s\t%d\t%s" %("all",pv,suv))
            continue
        else:
            continue